package com.dgz.coolshark.controller;

import com.dgz.coolshark.mapper.CategoryMapper;
import com.dgz.coolshark.mapper.UserMapper;
import com.dgz.coolshark.pojo.dto.UserLoginDto;
import com.dgz.coolshark.pojo.entity.Category;
import com.dgz.coolshark.pojo.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @Author duguozheng
 * @Date 2023/04/27  14:53
 * @Description CategoryController
 * @Version 1.0
 */
@RestController
@RequestMapping("/category/")
public class CategoryController {

    @Autowired
    CategoryMapper categoryMapper;

    @RequestMapping("select")
    public List<Category> select() {
        return categoryMapper.select();
    }

    @RequestMapping("delete")
    public void delete(int id) {
        categoryMapper.deleteById(id);
    }
    @RequestMapping("insert")
    public void insert(String name) {
        categoryMapper.insert(name);
    }
    @RequestMapping("update")
    public void update(@RequestBody Category category) {
        categoryMapper.update(category);
    }
}
